<?php
include('../pages/config.php');
session_start();
if (!session_is_registered('myusername')) {
	header("Location: index.php");
}

$currentuser = $_SESSION['myusername'];

?>
<table style="width: 100%">
	<tr><th style="width: 150px">Directory Number</th><th style="width: 200px">Changes</th><th style="width: 100px">Changed By</th><th style="width: 150px">Date Submitted</th></tr>
<?php
	$trans_results = mysql_query("SELECT * FROM metaswitch_log WHERE submitted_by = '$currentuser' ORDER BY date_changed DESC");
	//$trans_results = mysql_query(" SELECT * FROM `transaction_log` WHERE submitted_by = 'ctrader' ORDER BY `date_changed` DESC");

	//  Parse the trans_changes into a list format from the CSV format
	//$trans_changes = 
	
	for ($i = '0'; $row = mysql_fetch_array($trans_results), $i <= mysql_num_rows($trans_results); $i++)
	{
		//changes the background color of the row based on if the row is even or odd
		$row_bg_color=($i % 2 == 0) ? "#e5e5e5" : "#ffffff";
		echo "<tr onMouseOver=\"this.style.background= '#ffff99'\" onMouseOut=\"this.style.background= '$row_bg_color'\" style=\"background: $row_bg_color; border-top: solid 1px #000000\"><td>" . $row['trans_dn'] . "</td><td><pre>" . $row['trans_changes'] . "</pre></td><td>" . $row['submitted_by'] . "</td><td>" . $row['date_changed'] . "</td></tr>";
	
	}
?>
</table>
